home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
BORL_TIP
/
TI2000
/
TI2002.ASC
< prev
next >
Wrap
Text File
|
1993-04-19
|
3KB
|
133 lines
PRODUCT : Pascal NUMBER : 2002
VERSION : 7.0
OS : DOS
DATE : April 19, 1993 PAGE : 1/1
TITLE : Readjusting HeapLimit and HeapBlock
Program that demonstrates the allocation of different blocks
sizes and HeapLimit and HeapBlock in protected mode.^@
1. program testmem;
2. { If you try to allocate blocks of memory greater than 1k,
you can }
{ run out of memory handles before you run out of memory.
This }
{ has to do with the number of memory handles you can have
under }
{ protected mode, your blocks are larger than the amount
the }
{ suballocator is set to (1k), you can change this by
changing }
{ HeapLimit and HeapBlock (see below). HeapLimit should be
2 to 6 }
{ times the size of your block. HeapBlock should be 4+
times the }
{ size of HeapLimit. HeapLimit should not grow over 16k
and the }
{ max value of HeapBlock is 64k.
}
3. uses crt;
4. const
MaxSize = 2048; { your block size }
5. type
Trec = array[0..MaxSize] of byte;
6. var
Rec : ^Trec;
Total,
l : longint;
7. begin
{ Change the heap block size the suballocator uses if the
block }
{ size is larger than than HeapLimit.
}
if HeapLimit < MaxSize then begin
PRODUCT : Pascal NUMBER : 2002
VERSION : 7.0
OS : DOS
DATE : April 19, 1993 PAGE : 2/1
TITLE : Readjusting HeapLimit and HeapBlock
HeapLimit := MaxSize*2;
HeapBlock := HeapLimit*4;
end;
clrscr;
Total := 0;
Writeln('maxavail at start of program = ', maxavail);
l := 0;
repeat
gotoxy(1,2);
writeln(l, ' maxavail = ', maxavail:10, ' ');
WriteLn('MemAvail: ', MemAvail:10, ' ');
inc(l);
New(Rec);
Total := Total + MaxSize;
GotoXY(1,4);
WriteLn('Total: ', Total);
until false;
readln;
end.
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.